﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace ISFProject.Models
{
    public class NSSF
    {
        [Key]
        public int NSSFId { get; set; }

        [Required(ErrorMessage = "Please enter a name")]
        [StringLength(45, MinimumLength = 3, ErrorMessage = "Invalid field length")]
        [Display(Name="Name*")]
        public string Name { get; set; }

        public int AdressId { get; set; }//[required] 
        public virtual Address Adress { get; set; }

        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Please enter a valid email address")]
        [Display(Name = "Email address*")]
        [Required(ErrorMessage = "Please enter an email address")]
        public string Email { get; set; }

        [Required(ErrorMessage = "Please enter a telephone number")]
        [Display(Name = "Telephone number*")]
        [StringLength(45, MinimumLength = 5, ErrorMessage = "Invalid field length")]
        public string TelephoneNumber { get; set; }

        [Display(Name = "Fax number")]
        [StringLength(45, MinimumLength = 5, ErrorMessage = "Invalid field length")]
        public string FaxNumber { get; set; }

        public string YearOfMembership { get; set; } //getcurrentdate->year

        [Required(ErrorMessage = "Name of representative is missing")]
        [StringLength(45, ErrorMessage = "Invalid field length")]
        [Display(Name="Name of representative*")]
        public EmailAddressAttribute NameOfRepresentative { get; set; }

        [StringLength(45, ErrorMessage = "Invalid field length")]
        [Display(Name="Function of representative")]
        public string FunctionOfRepresentative { get; set; }

        [Required(ErrorMessage = "Please enter email of representative")]
        [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Please enter a valid email address")]
        [Display(Name = "Email of representative*")]
        public string EmailOfRepresentative { get; set; }

        public virtual List<School> Schools { get; set; }

       
    }
}